@extends('common.admin-master')

@section('html-body')
    <div class="content">

        <div class="header">
            <div class="stats">
                <p class="stat"><a href="#new_creater" data-toggle="tab">添加管理员</a></p>
                <p class="stat admin"><a href="#creater_list" data-toggle="tab">返回首页</a></p>
            </div>
            <h1 class="page-title">管理员管理</h1>
        </div>

        <ul id="myTab" class="nav nav-tabs">
            <li class="active admin"><a href="#creater_list" data-toggle="tab">管理员列表</a></li>
            <li><a href="#new_creater" data-toggle="tab">添加管理员</a></li>

        </ul>

        <div class="container-fluid">
            <div class="row-fluid">

                <div class="row-fluid">
                    <div id="TabContent" class="tab-content">
                        <div class="tab-pane fade in active" id="creater_list">
                            <div class="row-fluid">
                                <div class="block span12">
                                    <a href="#tablewidget" class="block-heading" data-toggle="collapse">管理员列表<span
                                                class="label label-warning">+{{count($admins)}}</span></a>
                                    <div id="tablewidget" class="block-body collapse in">
                                        <table class="table">
                                            <thead>
                                            <tr>
                                                <th>登录名</th>
                                                <th>邮箱</th>
                                                <th>电话</th>
                                                <th>操作</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            @if($admins)
                                            @foreach($admins as $admin)
                                            <tr>
                                                <td>{{$admin->username}}</td>
                                                <td>{{$admin->email}}</td>
                                                <td>{{$admin->phone}}</td>
                                                <td>
                                                    <a href="#new_creater" class="edit-admin" data-toggle="tab"
                                                       data="{{$admin->id}}">编辑</a>
                                                    <a href="javascript:;" class="del-admin" data="{{$admin->id}}">删除</a>
                                                </td>
                                            </tr>
                                            @endforeach
                                            @endif
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="pagination">
                                        <ul>
                                            {!! $admins->render() !!}
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>


                        <div class="tab-pane fade" id="new_creater">
                            <div class="container-fluid">
                                <div class="row-fluid">

                                    <div class="well">
                                        <ul class="nav nav-tabs">
                                            <li class="active"><a href="#home" data-toggle="tab">管理员信息</a></li>
                                        </ul>
                                        <div id="myTabContent" class="tab-content">
                                            <div class="tab-pane active in" id="home">
                                                <form method="post" id="form-admin">
                                                    <label>登录名</label>
                                                    <input type="text" name="username" class="input-xlarge">
                                                    <label>邮箱</label>
                                                    <input type="text" name="email" class="input-xlarge">
                                                    <label>电话</label>
                                                    <input type="text" name="phone" class="input-xlarge">
                                                    <label>密码</label>
                                                    <input type="password" name="password" class="input-xlarge">
                                                </form>
                                                <input type="hidden" id="user_id" value="0"/>
                                            </div>
                                            <div class="btn-toolbar">
                                                <button class="btn btn-primary save" type="button"><i class="icon-save"></i>
                                                    保存</button>
                                                <a href="#myModal" data-toggle="modal" class="btn">取消</a>
                                                <div class="btn-group">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <script>
        var EditAdminById   =   "{{route('Api.Admin.EditAdminById' ,['id'=>0])}}";
        var GetAdminById    =   "{{route('Api.Admin.GetAdminById')}}";
        var DelAdminById    =   "{{route('Api.Admin.DelAdminById')}}";
    </script>
    <script src="{{url('js/admin/manage.js')}}"></script>

@endsection


